<?php
/**
 *  💡 免责声明：本软件不得用于商业用途，仅做学习交流
 *  ⚠️ 权利声明：本软件由版权人提供产品技术支持
 *  📅 项目编号：NX2025-0135
 */
namespace App\Notifications;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Notification;

class ActiveNotificationTemp extends Notification implements ShouldQueue
{
    use Queueable;

    public $tries = 3; // 最大尝试次数

    protected $user;

    protected $msg;

    protected $type;

    /**
     * @param $user
     * @param $msg
     * @param $type
     */
    public function __construct($user, $msg, $type)
    {
        $this->user = $user;
        $this->msg = $msg;
        $this->type = $type;
        $this->onQueue('notifications');
    }

    /**
     * Get the notification's delivery channels.
     *
     * @param mixed $notifiable
     * @return array
     */
    public function via($notifiable)
    {
        return ['database'];
    }

    public function toDatabase($notifiable)
    {
        return [
            'type' => 'order_closed',
            'order_id' => 1,
            'message' => '您的订单已超时关闭',
            'link' => '/orders/',
        ];
    }
}
